Writing and debugging formulas
The Formula Helper allows you to select a template token and paste it into a formula's body. The Select ID control can be used for picklists, lookup, and status fields when you want to select an ID or integration code for use in your formula. Loops through related records can be used in formulas in the same way as in templates. The loop's body will be replicated during parsing using data from each related record. Click Validate Formula for quick validation of the formula's syntax. This will process the formula on an arbitrarily selected object record. For formula validation and debugging, you must have at least record available.
Click Debug Formula for detailed debugging. Select the object record to run the formula on in the lookup window. As illustrated in the following screen shot, the debugger shows the following information:
- Original formula
- Formula parsed using the selected record's data (with line numbers on the left for convenience)
- Debugging output (if any)
- Result of formula calculation
- Error message (if any)
If a particular line in parsed formula is causing an error, that line will be highlighted.
If your formula has no errors, but does not produce the results you expect, you can open the console in your browser to view any output resulting from running the script, including error messages. To open the console in Chrome, use the keyboard shortcut command Ctrl + Shift + i or click F12. To open the console in Firefox, use the keyboard shortcut Ctrl + Shift + k or select Web Console from the Web Developer submenu.